package com.hongyue.dey01;

import java.text.ParseException;
import java.time.DayOfWeek;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Scanner;

public class Demo {
    public static void main(String[] args) throws ParseException {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入数字日期字符串(格式:2000-01-01)");
        String lr = sc.nextLine();
//        String lr = "2017-07-22";
        lr += " 00时00分00秒";
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH时mm分ss秒");
        LocalDateTime parse = LocalDateTime.parse(lr, dtf);
        int dayOfYear = parse.getDayOfYear();
        DayOfWeek week = parse.getDayOfWeek();
        int value = week.getValue();
        DateTimeFormatter dtf1 = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH时mm分ss秒");
        String format = parse.format(dtf1);
        System.out.println(format.substring(0, 11)+"是星期"+(value));
        System.out.println("是"+format.substring(0, 5)+"的第"+dayOfYear);
    }
}
